package org.myspringmvc.web.bind.annotation;

/**
 * @author 莫磊
 * @date 2025/8/13
 * @description
 */
public enum RequestMethod {

    GET("get"),
    POST("post"),
    PUT("put"),
    DELETE("delete"),
    PATCH("patch"),
    OPTIONS("options"),
    HEAD("head"),
    TRACE("trace");

    final String value;

    RequestMethod(String value) {
        this.value = value.toLowerCase();
    }

    public static RequestMethod getByValue(String value) {
        for (RequestMethod requestMethod : RequestMethod.values()) {
            if (requestMethod.value.equals(value)) {
                return requestMethod;
            }
        }
        return null;
    }
}
